<?php

/*
 *  This file is part of Urd.
 *
 *  Urd is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 3 of the License, or
 *  (at your option) any later version.
 *  Urd is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program. See the file "COPYING". If it does not
 *  exist, see <http://www.gnu.org/licenses/>.
 *
 * $LastChangedDate: 2008-07-10 23:59:20 +0200 (Thu, 10 Jul 2008) $
 * $Rev: 1285 $
 * $Author: gavinspearhead $
 * $Id: autoincludes.php 1285 2008-07-10 21:59:20Z gavinspearhead $
 */

// This is an include-only file:
if (!defined('ORIGINAL_PAGE')) die('This file cannot be accessed directly.');


function urd_autoload($class)
{
	$pathai = realpath(dirname(__FILE__));
	switch ($class) {
	case 'button': $file = 'buttons.php'; break;
	case 'button_c': $file = '../html/admin_buttons.php'; break;
	case 'get_opt': $file = 'libs/getopt.php'; break;
	case 'socket': $file = 'libs/socket.php'; break;
	case 'Base_NNTP_Client': $file = 'libs/base_nntp_client.php'; break;
	case 'NNTP_Client' : $file = 'libs/nntp_client.php' ; break;
	case 'action': $file = '../urdd/action.php'; break;
	case 'queue': $file = '../urdd/queue.php'; break;
	case 'schedule': 
	case 'job': $file = '../urdd/schedule.php'; break;
	case 'thread_list':
	case 'thread': $file = '../urdd/thread.php'; break;
	case 'connection':
	case 'conn_list':  $file = '../urdd/urdd_connection.php'; break;
	case 'URD_NNTP': $file = 'nntp.class.php'; break;
	case 'command': $file = '../urdd/urdd_command.php'; break;
	case 'TableSetData':
	case 'TableBinaries':
	case 'TableParts':
	case 'TableGroups' :
	case 'DatabaseConnection': $file = 'db.class.php'; break;
	case 'pr_file':
	case 'pr_list': $file = 'pr_file.php'; break;
	case 'file_list': 
	case 'a_file': $file = '../html/view_files.php'; break;
	case 'urdd_client': $file = '../urdd/urdd_client.php'; break;
	case 'server_data': $file = '../urdd/server_data.php'; break;
	case 'usenet_servers': 
	case 'usenet_server': $file = '../urdd/urdd_usenet_servers.php'; break;
	case 'usenet_servers_c': $file = '../html/admin_usenet_servers.php'; break;
	case 'periods_c':
	case 'period_c': $file = 'periods.php'; break;
	case 'module' : $file = '../urdd/urdd_config.php'; break;
	case 'pref_line' : $file = 'pref_functions.php'; break;
	case 'QuickMenuItem' : $file = '../html/ajax_showquickmenu.php' ; break;
	case 'Downloadinfo' : $file = '../html/ajax_showtransfers.php' ; break;
	case 'Mail_mimeDecode' : $file = 'libs/mimedecode.php'; break;
    case 'urd_xml_writer' : $file = 'xml_functions.php'; break;
    case 'urd_xml_reader' : $file = 'xml_functions.php'; break;
	default :
		throw new exception ("Class not found $class");
	}
	require_once ($pathai . '/' . $file);
}

spl_autoload_register('urd_autoload');

?>
